#!/usr/bin/env python

TEST_MAP = {
    -1:"unit/crashers/crash_firefox_trunk_20081110.svg",
    -1:"unit/crashers/crash_opera_962_win.html",
    12:"unit/layouttests/dumpAsText.html",
    13:"unit/layouttests/dumpChildFrames.html",
    14:"unit/layouttests/failure.html",
    15:"unit/layouttests/frameDump.html",
    16:"unit/layouttests/frameNoDump.html",
    21:"unit/layouttests/innerText/blank.html",
    22:"unit/layouttests/innerText/blocks-css.html",
    23:"unit/layouttests/innerText/blocks.html",
    24:"unit/layouttests/innerText/br.html",
    25:"unit/layouttests/innerText/css-dom-read.html",
    26:"unit/layouttests/innerText/css-selector-text.html",
    27:"unit/layouttests/innerText/hidden.html",
    28:"unit/layouttests/innerText/inlines.html",
    29:"unit/layouttests/innerText/script.html",
    30:"unit/layouttests/innerText/simple.html",
    31:"unit/layouttests/innerText/tables-1.html",
    17:"unit/layouttests/noDumpChildFrames.html",
    18:"unit/layouttests/notifyDone.html",
    19:"unit/layouttests/timeout.html",
    20:"unit/layouttests/waitUntilDoneOnload.html",
    2:"unit/layout_fail.html",
    3:"unit/layout_pass.html",
    6:"unit/reftest:2ec9064e43b7ddd48e95a40ecf08f94d",
    5:"unit/reftest:59259f892b417b0917b537108dbeeeaa",
    8:"unit/reftest:a358677320a39f95933c35601cec2cf0",
    7:"unit/reftest:bae27c26cafeb1f84bfeedb65c79a503",
    4:"unit/reftest:d11397392461e981585aee60a2241777",
    1:"unit/test_alerts.html",
    9:"unit/test_mochi_fail.html",
    10:"unit/test_mochi_mochikit_json_bug.html",
    11:"unit/test_mochi_pass.html",
    -1:"unit/vertical_tab.html",
}

import simplejson, pdb

c = open("fixture.json").read()
objs = simplejson.loads(c)
for o in objs:
    t = o["fields"]["test"]
    if isinstance(t, int):
        if t in TEST_MAP:
            o["fields"]["test"] = TEST_MAP[o["fields"]["test"]]

open("fixture_new.json", "wb").write(simplejson.dumps(objs, indent=2))
